<%@ Control Language="C#" Inherits="System.Web.Mvc.ViewUserControl<WebClient.Models.ViewModels.GroupViewModel>" %>
<div class="AdminPageText">
List Of Users
</div>
<table class="Grid" cellpadding="0" cellspacing="0">
	<thead>
		<tr>
			<th>UserName</th>
			<th>Email</th>
			<th>Role</th>
			<th></th>
			<th></th>
		<tr>
	</thead>
	<% for (int i=0; i<Model.UsersModel.GetModel.LstObjModel.Count; i++){
		if (i % 2 != 0) {%>
		<tr class="Row" id="row-<%= Model.UsersModel.GetModel.LstObjModel[i].ID %>">
		<% }
		else { %>
		<tr class="AlternatingRow" id="row-<%= Model.UsersModel.GetModel.LstObjModel[i].ID %>">
		<% } %>
			<td><span style=""><%= Model.UsersModel.GetModel.LstObjModel[i].UserName %></span></td>
			<td><span style=""><%= Model.UsersModel.GetModel.LstObjModel[i].Email %></span></td>
			<td><span style=""><%= Model.UsersModel.GetModel.LstObjModel[i].Role.Name %></span></td>
			<td>
				<a href="../../Admin/DetailOfUsers?id=<%= Model.UsersModel.GetModel.LstObjModel[i].ID %>">
				<span style="color: Blue; text-decoration: underline">Select</span>
				</a>
			</td>
			<td>
                <% if (Model.UsersModel.GetModel.LstObjModel[i].Role.Name.ToUpper() == "MANAGER")
                   { %>
				    <%= Ajax.ActionLink("Delete", "DeleteUsers", "Admin", new { id = Model.UsersModel.GetModel.LstObjModel[i].ID, role = Model.UsersModel.GetModel.LstObjModel[i].Role.Name, idrestaurant = Model.RestaurantModel.GetModel.LstObjModel[0].ID }, new AjaxOptions { Confirm = "Are you sure you want to Delete it? This action cannot be undone.", HttpMethod = "Delete", OnComplete = "jsonDelete_OnComplete" })%>
                <% }
                   else
                   { %>
                   <%= Ajax.ActionLink("Delete", "DeleteUsers", "Admin", new { id = Model.UsersModel.GetModel.LstObjModel[i].ID, role = Model.UsersModel.GetModel.LstObjModel[i].Role.Name }, new AjaxOptions { Confirm = "Are you sure you want to Delete it? This action cannot be undone.", HttpMethod = "Delete", OnComplete = "jsonDelete_OnComplete" })%>
                <% } %>
			</td>
		</tr>
	<% } %>  
</table>
